<script lang="ts">
import { computed, defineComponent, onMounted, ref } from "vue";
import { useStore } from "@/store";
import HelloWorld from "@/components/HelloWorld.vue";

import {useI18n} from "vue-i18n";
import { Catch } from "@/utils/storage"

export default defineComponent({
    setup() {
        const loading = ref(false);
        const store = useStore();
        const { user, ads } = store.state;
		const language = computed(()=>store.state.language)
		
		const { t, locale: localeLanguage } = useI18n()

        const chi = (v: any) => {
            store.dispatch("setLanguage",'en');
			localeLanguage.value = 'en'
			
			console.log(Catch.get('a'))
        };
        onMounted(() => {
            store.dispatch("getAds");
        });
        return {
            ads,
            chi,
			language,
            user,
            loading
        };
    },
    async asyncData({ store, route }: any) {
        return store.dispatch("getAds");
    },
    components: { HelloWorld }
})
</script>
<template>
<div>
<button @click="chi(1)">123</button>
<van-button @click="chi(1)">123</van-button>
</div>
</template>